<?php

        require_once "../../konfigurasi.php";
        
        koneksi_buka();
		$bulan = date('m');
		$tahun = date('Y');
		
		$q_d_perkara = mysql_query("select YEAR(tgl_dimulai) as tahun, MONTH(tgl_dimulai) as bulan, DAY(tgl_dimulai) as hari, count(kd_perkara) as total 
		from t_perkara where MONTH(tgl_dimulai)='$bulan' and YEAR(tgl_dimulai)='$tahun' group by DATE(tgl_dimulai)");
		$i=0;
		while($dt = mysql_fetch_array($q_d_perkara)) {
			
			$d_perkaras[$i] = array('total' => $dt['total'], 'bulan' =>$dt['bulan'], 'hari' =>$dt['hari'], 'tahun' =>$dt['tahun']);
			$i++;
		}
		
		$hasil = array('perkaras'=>$d_perkaras);
			echo json_encode($hasil);
        
?>
